<style include="settings-shared">
  #appManagement,
  #appNotifications {
      border-bottom: var(--cr-separator-line);
  }
</style>

<settings-animated-pages id="pages" section="apps"
    focus-config="[[focusConfig_]]">
  <div route-path="default">
    <cr-link-row id="appManagement"
        label="$i18n{appManagementTitle}"
        on-click="onClickAppManagement_"
        role-description="$i18n{subpageArrowRoleDescription}">
    </cr-link-row>
    <template is="dom-if" if="[[showAppNotificationsRow_]]">
      <cr-link-row id="appNotifications"
          label="$i18n{appNotificationsTitle}"
          on-click="onClickAppNotifications_"
          role-description="$i18n{subpageArrowRoleDescription}"
          sub-label= "[[getAppListCountDescription_(
              appsWithNotifications_.*, isDndEnabled_)]]">
      </cr-link-row>
    </template>
    <template is="dom-if" if="[[showAndroidApps]]">
      <template is="dom-if" if="[[havePlayStoreApp]]" restamp>
        <div id="android-apps" class="settings-box first"
            actionable$="[[androidAppsInfo.playStoreEnabled]]"
            on-click="onAndroidAppsSubpageTap_">
          <div class="start settings-box-text">
            $i18n{androidAppsPageLabel}
            <div class="secondary" id="secondaryText">
              <localized-link
                  localized-string="[[i18nAdvanced('androidAppsSubtext')]]">
              </localized-link>
            </div>
          </div>
          <cr-policy-pref-indicator pref="[[prefs.arc.enabled]]"
              icon-aria-label="$i18n{androidAppsPageTitle}">
          </cr-policy-pref-indicator>
          <template is="dom-if" if="[[androidAppsInfo.playStoreEnabled]]">
            <cr-icon-button class="subpage-arrow"
                aria-label="$i18n{androidAppsPageTitle}"
                aria-describedby="secondaryText"
                aria-roledescription="$i18n{subpageArrowRoleDescription}">
            </cr-icon-button>
          </template>
          <template is="dom-if" if="[[!androidAppsInfo.playStoreEnabled]]">
            <div class="separator"></div>
            <cr-button id="enable"
                disabled="[[isEnforced_(prefs.arc.enabled)]]"
                on-click="onEnableAndroidAppsTap_"
                aria-label="$i18n{androidAppsPageTitle}"
                aria-describedby="secondaryText"
                deep-link-focus-id$="[[Setting.kTurnOnPlayStore]]">
              $i18n{androidAppsEnable}
            </cr-button>
          </template>
        </div>
      </template>
      <template is="dom-if" if="[[!havePlayStoreApp]]" restamp>
        <cr-link-row id="manageApps" label="$i18n{androidAppsManageApps}"
            on-click="onManageAndroidAppsTap_" external
            deep-link-focus-id$="[[Setting.kManageAndroidPreferences]]">
        </cr-link-row>
      </template>
    </template>
    <template is="dom-if" if="[[showStartup]]">
      <div class="settings-box">
        <div class="start settings-box-text" aria-hidden="true">
            $i18n{onStartupTitle}
        </div>
        <settings-dropdown-menu id="onStartupDropdown"
            label="$i18n{onStartupTitle}"
            pref="{{prefs.settings.restore_apps_and_pages}}"
            menu-options="[[onStartupOptions_]]"
            deep-link-focus-id$="[[Setting.kRestoreAppsAndPages]]">
        </settings-dropdown-menu>
      </div>
    </template>
  </div>

  <!-- APP NOTIFICATIONS -->
  <template is="dom-if" route-path="/app-notifications">
    <settings-subpage page-title="$i18n{appNotificationsTitle}">
      <settings-app-notifications-subpage>
      </settings-app-notifications-subpage>
    </settings-subpage>
  </template>

  <!-- APP MANAGEMENT -->
  <template is="dom-if" route-path="/app-management">
    <settings-subpage
        page-title="$i18n{appManagementTitle}"
        search-label="$i18n{appManagementSearchPrompt}"
        search-term="{{searchTerm}}">
      <settings-app-management-page search-term="[[searchTerm]]">
      </settings-app-management-page>
    </settings-subpage>
  </template>

  <template is="dom-if" route-path="/app-management/detail">
    <settings-subpage
        page-title="[[app_.title]]"
        title-icon="[[iconUrlFromId_(app_)]]">
      <app-management-uninstall-button slot="subpage-title-extra"
          app="[[app_]]"
          uninstall-label="$i18n{appManagementUninstallLabel}"
          policy-label="$i18n{appManagementAppInstalledByPolicyLabel}">
      </app-management-uninstall-button>
      <app-management-app-detail-view>
      </app-management-app-detail-view>
    </settings-subpage>
  </template>

  <!-- ANDROID APPS -->
  <template is="dom-if" if="[[showAndroidApps]]" restamp>
    <template is="dom-if" route-path="/androidAppsDetails">
      <settings-subpage page-title="$i18n{androidAppsPageLabel}">
        <settings-android-apps-subpage
          android-apps-info="[[androidAppsInfo]]"
          prefs="{{prefs}}"
          show-arcvm-manage-usb="[[showArcvmManageUsb]]">
        </settings-android-apps-subpage>
      </settings-subpage>
    </template>
  </template>

  <template is="dom-if" if="[[showArcvmManageUsb]]" restamp>
    <template is="dom-if" route-path="/androidAppsDetails/sharedUsbDevices">
      <settings-subpage page-title="$i18n{guestOsSharedUsbDevicesLabel}">
         <settings-guest-os-shared-usb-devices guest-os-type="arcvm">
         </settings-guest-os-shared-usb-devices>
      </settings-subpage>
    </template>
  </template>

  <!-- Plugin VM -->
  <template is="dom-if" if="[[showPluginVm]]" restamp>
    <template is="dom-if" route-path="/app-management/pluginVm/sharedPaths">
      <settings-subpage page-title="$i18n{guestOsSharedPaths}">
        <settings-guest-os-shared-paths
            guest-os-type="pluginVm" prefs="{{prefs}}">
        </settings-guest-os-shared-paths>
      </settings-subpage>
    </template>
    <template is="dom-if"
        route-path="/app-management/pluginVm/sharedUsbDevices">
      <settings-subpage page-title="$i18n{guestOsSharedUsbDevicesLabel}">
        <settings-guest-os-shared-usb-devices guest-os-type="pluginVm">
        </settings-guest-os-shared-usb-devices>
      </settings-subpage>
    </template>
  </template>
</settings-animated-pages>
